package com.xiaoyu.lanling.event.charming.viewholder

import `in`.srain.cube.views.list.ViewHolderBase
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.facebook.drawee.view.SimpleDraweeView
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.event.charming.LevelUpMeansItem
import com.xiaoyu.lanling.media.image.ImageViewUtil
import kotlinx.android.synthetic.main.level_up_means_item.view.*

class LevelUpMeansViewHolder : ViewHolderBase<LevelUpMeansItem>() {

    private lateinit var icon: SimpleDraweeView
    private lateinit var title: TextView

    override fun createView(layoutInflater: LayoutInflater, parent: ViewGroup): View? {
        val rootView = layoutInflater.inflate(R.layout.level_up_means_item, parent, false)
        icon = rootView.icon
        title = rootView.title
        return rootView
    }

    override fun showData(position: Int, itemData: LevelUpMeansItem) {
        ImageViewUtil.loadImage(icon, itemData.iconLoadParam)
        title.text = itemData.title
    }
}